@extends('admin._layouts.default')

@section('main')

      <div class="row-fluid ">
        <div class="box gradient">
          <div class="title">
            <h3><a href="city_index.html"  class="btn btn-mini pull-right" style="margin:5px 5px 0 0"><i class="fa fa-hand-o-left"></i> 返回</a>
            <i class="fa fa-share-alt"></i>

      <?php if ($user->hasAccess('admin')){ ?>
            <span>创建城市运营商</span>

            <?php }elseif($user->hasAccess('city')){ ?>
            <span>创建直营商</span>

            <?php } ?>
            </h3>
          </div>
          <div class="content">

            {{ Form::open(array('route' => 'admin.cities.store','id'=>'cities','class'=>'bs-docs-example form-horizontal')) }}

      <?php if ($user->hasAccess('admin')){ ?>


              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword">姓名</label>
                <div class="controls span5 input-append">
                  <input type="text" id="inputUsername" name="username" placeholder="管理者姓名" class="row-fluid"><span class="add-on"><i class="icon-user"></i></span>
                </div>
              </div>
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword">所在城市</label>
                <div class="controls span5">
                  <div id="myaddress"  class="form-row control-group row-fluid">
                  </div>
                </div>
              </div>
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputEmail">手机</label>
                <div class="controls span5 input-append">
                  <input type="text" id="inputPhone" name="mobile" placeholder="手机号码" class="row-fluid"><span class="add-on"><i class="icon-phone"></i></span>
                </div>
              </div>
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword">初始密码</label>
                <div class="controls span5 input-append">
                  <input type="password" id="inputPassword" name="pwd" placeholder="初始密码" class="row-fluid"><span class="add-on"><i class="icon-lock"></i></span>
                </div>
              </div>
              <!--  <div class="control-group row-fluid">
              <div class="controls span5 offset4">
                <label class="checkbox">
                  <input type="checkbox"> Remember me
                </label>
              </div>
            </div> -->
              <div class="control-group row-fluid">
                <div class="controls span5 offset4">
                  <button type="submit" onclick="sign();" class="btn btn-primary">新增</button>

                </div>
              </div>

            <?php }elseif($user->hasAccess('city')){ ?>


              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword">区域名称</label>
                <div class="controls span5 input-append">
                  <input type="text" id="inputUsername" name="area" placeholder="区域名称" class="row-fluid"><span class="add-on"><i class="fa fa-flag"></i></span>
                </div>
              </div>
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword">覆盖小区</label>
                <div class="controls span5 input-append">
                  <input type="text" id="inputUsername" name="xiaoqu[]" placeholder="区域名称" class="row-fluid"><span class="add-on"><i class="fa fa-puzzle-piece"></i></span>
                </div>
                <div class="controls span2">
                  <a href="javascript:void (0);" onclick="plus()" class="btn btn-primary" rel="tooltip" data-placement="left" data-original-title="新增一条"><i class="fa  fa-plus"></i></a><!-- 第一条不能删 -->
                </div>
              </div>
              <div id="templates" style="display: none;">
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword"></label>
                <div class="controls span5 input-append">
                  <input type="text" name="xiaoqu[]" id="inputUsername" placeholder="区域名称" class="row-fluid"><span class="add-on"><i class="fa fa-puzzle-piece"></i></span>
                </div>
                <div class="controls span2">
                  <a href="javascript:void (0);" onclick="unplus(this)" class="btn btn-inverse" rel="tooltip" data-placement="left" data-original-title="删除本条"><i class="fa  fa-trash"></i></a>
                </div>
              </div>
              </div>
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword">直营商姓名</label>
                <div class="controls span5 input-append">
                  <input type="text" name="username" id="inputUsername" placeholder="管理者姓名" class="row-fluid"><span class="add-on"><i class="icon-user"></i></span>
                </div>
              </div>
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputEmail">直营商手机</label>
                <div class="controls span5 input-append">
                  <input type="text" name="mobile" id="inputPhone" placeholder="手机号码" class="row-fluid"><span class="add-on"><i class="icon-phone"></i></span>
                </div>
              </div>
              <div class="control-group row-fluid">
                <label class="control-label span4" for="inputPassword">初始密码</label>
                <div class="controls span5 input-append">
                  <input type="password" name="pwd" id="inputPassword" placeholder="初始密码" class="row-fluid"><span class="add-on"><i class="icon-lock"></i></span>
                </div>
              </div>
              <!--  <div class="control-group row-fluid">
              <div class="controls span5 offset4">
                <label class="checkbox">
                  <input type="checkbox"> Remember me
                </label>
              </div>
            </div> -->
              <div class="control-group row-fluid">
                <div class="controls span5 offset4">
                  <button type="submit" class="btn btn-primary">创建</button>
                </div>
              </div>

            <?php } ?>
              {{ Form::close() }}


            </div>
        </div>
        <!-- End box -->
      </div>


@stop




@section('script')
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/full-calendar/fullcalendar.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.peity.min.js') }}"></script>
<script type="text/javascript" language="javascript" src="{{ URL::asset('ad/js/plugins/datatables/js/jquery.dataTables.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/chosen/chosen/chosen.jquery.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/flot/jquery.flot.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.uniform.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/raphael.2.1.0.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/justgage.1.0.1.min.js') }}"></script>


<script src="{{ URL::asset('ad/js/jquery.provincesCity.js') }}" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
        $("#myaddress").province_city_county();
    });
</script>
<script src="{{ URL::asset('ad/js/scripts.js') }}"></script>
    <script type="text/javascript" charset="utf-8">

    // Datatables
    $(document).ready(function() {
      var dontSort = [];
                $('#datatable_city thead th').each( function () {
                    if ( $(this).hasClass( 'no_sort' )) {
                        dontSort.push( { "bSortable": false } );
                    } else {
                        dontSort.push( null );
                    }
      } );
      $('#datatable_city').dataTable( {
        "sDom": "<'row table_top_bar'<'row-fluid'>'<'to_hide_phone'>'f'<'>r>t<'row'>",
         "sDom": "<'row table_top_bar'<'row-fluid'<'to_hide_phone' f>>><'row'>",
         "aaSorting": [[ 1, "asc" ]],
        "bPaginate": false,
        "bJQueryUI": false,
        "aoColumns": dontSort

      } );
      $.extend( $.fn.dataTableExt.oStdClasses, {
        "s`": "dataTables_wrapper form-inline"
      } );
    } );

    function plus(){
        var html = $('#templates').html();
        $('#templates').before(html);
    }
    function unplus(obj){
        $(obj).parent().parent().remove();
    }

        function sign(){
            $('#cities').submit();
        }
    </script>
@stop
